<div id="lorikeet"></div>


<script type="text/javascript">


    var charge = ${Charge};
    var scanNum = ${ScanNumber};
    var sequence = "${Seq}";
    var fileName = "${RawFile}";
    var precursorMz = ${PrecursorMZ};
    var staticMods = [{"modMass":57.021464,"aminoAcid":"C"}];
    var variableMods = [];
    <g:set var="i" value="${0}" />
    <g:each in="${Oxidations}" var="oxi">
    variableMods[${i}] = {index: ${oxi}, modMass: 15.994915, aminoAcid: 'M'};<g:set var="i" value="${i+1}" />
    </g:each>


    <g:set var="i" value="${1}" />
    var ms2peaks = [
      <g:each in="${Peaks}" var="peak">${peak}<g:if test="${i<Peaks.size()}">,</g:if><g:set var="i" value="${i+1}" /></g:each>];

    $(document).ready(function () {

            /* render the spectrum with the given options */
            $("#lorikeet").specview({"sequence":sequence,
                                      "scanNum":scanNum,
                                      "charge":charge,
                                      "precursorMz":precursorMz,
                                      "fileName":fileName,
                                      "staticMods":staticMods,
                                      "variableMods":variableMods,
                                      <g:if test="${Acetylation}">"ntermMod": 42.010565,</g:if>
                                      "peaks": ms2peaks});

           lorikeetInit();
    });
</script>